<%@ page language="java" %>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.utils.StringUtils,
                 com.scalar.chiptrack.operations.release.forms.SortReleaseForm,
                 com.scalar.chiptrack.operations.release.SortRelease,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.commons.Constants"%>


<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/sortRelease.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();
  SortReleaseForm sortReleaseForm = (SortReleaseForm)request.getAttribute( "sortReleaseForm" );
  SortRelease sortRelease = sortReleaseForm.getSortRelease();
%>
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>

<SCRIPT language="JavaScript">
function sendMail ( assmReleaseId )
{
    newWindow = window.open ('<%=chipTracContext%>/sendAssmMail.do?type=Sort&assmReleaseId=' + assmReleaseId,'sendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    newWindow.focus();
}
function confirmSortRelease()
{
    var sortReleaseId = document.sortReleaseForm['sortRelease.sortRelId'].value;
    document.sortReleaseForm.action='<%=chipTracContext%>/sortRelease.do?action=approved&isConfirm=true&sortRelId='+sortReleaseId;
    document.sortReleaseForm.submit();
}
function cancelSortRelease()
{
    var sortReleaseId = document.sortReleaseForm['sortRelease.sortRelId'].value;
    document.sortReleaseForm.action='<%=chipTracContext%>/sortRelease.do?action=cancel&isCancel=true&sortRelId='+sortReleaseId;
    document.sortReleaseForm.submit();
}
function closeSortRelease()
{
    var sortReleaseId = document.sortReleaseForm['sortRelease.sortRelId'].value;
    document.sortReleaseForm.action='<%=chipTracContext%>/sortRelease.do?action=close&isClose=true&sortRelId='+sortReleaseId;
    document.sortReleaseForm.submit();
}

</SCRIPT>
<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
    <html:form name="sortReleaseForm" type="com.scalar.chiptrack.operations.release.forms.SortReleaseForm" action="/sortRelease.do" scope="request">
        <nested:nest property="sortRelease" >
            <%String bgcolor = "";%>
            <nested:equal property="status" value="Cancelled">
            <TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='90%' background="<%=chipTracContext%>/jsp/includes/images/cancelled_icon.gif" bordercolor="#000000" ALIGN='CENTER'><TR><TD>
            </nested:equal>
            <nested:notEqual property="status" value="Cancelled">
            <%bgcolor = "bgcolor='#FFFFEE'";%>
            <TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='90%' bordercolor='#000000' ALIGN='CENTER'><TR><TD>
            </nested:notEqual>
            <TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='90%' bordercolor='#000000' ALIGN='CENTER'>
                <logic:equal  name="isConfirm" value="true">
                <logic:equal name="showMessage" value="TRUE">
                    <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_APPROVE_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
                    <td colspan='4'>
                    <font class='NArialL'><font color='red'>Are you sure, you want to Approve this Sort Release &nbsp;&nbsp;</font></font>
                    <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:confirmSortRelease();' onmouseover="window.status='Confirm this Sort Release';return true" onmouseout="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/confirm.gif' border='0'></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<%=chipTracContext%>/sortRelease.do" onMouseOver="window.status='Go Back to Main Sort Release Menu';return true" onMouseOut="window.status='';return true">
                    <img src='<%=chipTracContext%>/jsp/includes/images/back.gif' border='0'></a>
                    </td>
                </tr>
                </logic:equal>
                <logic:equal  name="isCancel" value="true">
                <logic:equal name="showMessage" value="TRUE">
                    <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_APPROVE_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
                    <td colspan='4'>
                    <font class='NArialL'><font color='red'>Are you sure, you want to Cancel this Sort Release &nbsp;&nbsp;</font></font>
                    <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:cancelSortRelease();' onmouseover="window.status='Cancel this Sort Release';return true" onmouseout="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/confirm.gif' border='0'></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<%=chipTracContext%>/sortRelease.do" onMouseOver="window.status='Go Back to Main Sort Release Menu';return true" onMouseOut="window.status='';return true">
                    <img src='<%=chipTracContext%>/jsp/includes/images/back.gif' border='0'></a>
                    </td>
                </tr>
                </logic:equal>
                <logic:equal  name="isClose" value="true">
                <logic:equal name="showMessage" value="TRUE">
                    <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_APPROVE_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
                    <td colspan='4'>
                    <font class='NArialL'><font color='red'>Are you sure, you want to Close this Sort Release &nbsp;&nbsp;</font></font>
                    <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:closeSortRelease();' onmouseover="window.status='Close this Sort Release';return true" onmouseout="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/confirm.gif' border='0'></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<%=chipTracContext%>/sortRelease.do" onMouseOver="window.status='Go Back to Main Sort Release Menu';return true" onMouseOut="window.status='';return true">
                    <img src='<%=chipTracContext%>/jsp/includes/images/back.gif' border='0'></a>
                    </td>
                </tr>
                </logic:equal>

                <TR>
                    <TD width="90%" valign="center" >&nbsp;</TD>
                    <TD width="5%" valign="center" >
                        <a href="javascript:window.print();" title='Click to Print Sort Release Instructions'><img height="80" width="60" src="<%=chipTracContext%>/jsp/includes/images/printer_icon_small.gif" border="0"></a>
                    </TD>
                    <TD width="5%" valign="center">
                        <a href="javascript:sendMail('<nested:write property="sortRelId"/>');" title='Click to Mail Sort Release Instructions'><img src="<%=chipTracContext%>/jsp/includes/images/email1.gif" border="0"></a>
                    </TD>
                </TR>
                <nested:hidden property="sortRelId"/>
            </TABLE>
            <table width='90%' border='1' bordercolor='black' cellspacing='0'  cellpadding='0' align='center' <%=bgcolor%> >
                <tr>
                    <td align='center' bgcolor='#DEE1E2' CLASS='NArialW'><B>&nbsp;<nested:write property="vendName"/></B></td>
                </tr>
                <tr>
                    <td align='center' bgcolor='#DEE1E2' CLASS='NArialW'><B>Wafer Sort Request</B></td>
                </tr>
                <tr>
                    <td>
                        <table width='100%' cellspacing='0' cellpadding='0'>
                            <tr>
                                <td colspan='4' align='left' CLASS='NArialL'><B>1. Customer</B></td>
                            </tr>
                            <tr>
                                <td width='25%' align='left' CLASS='NArialRS'>Customer name</td>
                                <td width='50%' colspan='2' align='left' CLASS='NArialRS'>&nbsp;<B><nested:write property="custName"/></B></td>
                                <td width='25%'>
                                    <table width='100%'>
                                        <tr>
                                            <td width='75%' align='left' CLASS='NArialRS'>Customer #</td>
                                            <td width='25%' align='left' CLASS='NArialRS'>&nbsp;<B><nested:write property="customerNumber"/></B></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td width='25%' align='left' CLASS='NArialRS'>Customer contact</td>
                                <td width='25%' align='left' CLASS='NArialRS'><B>&nbsp;Name</B></td>
                                <td width='25%' align='left' CLASS='NArialRS'><B>&nbsp;Email</B></td>
                                <td width='25%' CLASS='NArialRS'>&nbsp;</td>
                            </tr>
                            <tr>
                                <td align='left'>&nbsp;</td>
                                <td align='left' colspan=2 CLASS='NArialRS' rowspan=2>
                                <table width='100%' cellspacing='0'>
                                    <nested:iterate property="contactPersonsList" type="com.scalar.chiptrac.operations.release.ContactPerson" >
                                        <tr>
                                            <td width='50%' align='left' CLASS='NArialRS'><nested:write property="name"/></td>
                                            <td width='50%' align='left' CLASS='NArialRS'><nested:write property="email"/></td>
                                        </tr>
                                     </nested:iterate>
                                </table>
                                </td>
                                <td align='right' style='border-left:2px solid black;border-bottom:2px solid black;border-top:2px solid black'>
                                    <table width='100%' cellspacing='0'>
                                        <tr>
                                            <td width='60%' align='left' CLASS='NArialRS'>Date YYYY/DD/MM</td>
                                            <td width='40%' align='left' CLASS='NArialRS'>&nbsp;<%=sortRelease.getSortRelDate() != null ? StringUtils.formatDate( sortRelease.getSortRelDate() ,"MM/dd/yyyy","yyyy/dd/MM" ): ""%></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align='left' CLASS='NArialRS'>&nbsp;</td>
                                <td align='right' style='border-left:2px solid black;border-bottom:2px solid black'>
                                    <table width='100%' cellspacing='0'>
                                        <tr>
                                            <td width='60%' align='left' CLASS='NArialRS'>P O #</td>
                                            <td width='40%' align='left' CLASS='NArialRS'>&nbsp;<nested:write property="sortRelPO"/></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr><td colspan='4'>&nbsp;</td></tr>
                            <tr>
                                <td align='left'>&nbsp;</td>
                                <td align='left'>&nbsp;</td>
                                <td align='left'>&nbsp;</td>
                                <td align='right' style='border-left:2px solid black;border-bottom:2px solid black;border-top:2px solid black'>
                                    <table width='100%' cellspacing='0'>
                                        <tr>
                                            <td width='60%' align='left' class='NArialRS' nowrap><B>Sort Request # :</B></td>
                                            <td width='40%' align='left' class='NArialRS'><B>&nbsp;<nested:write property="sortRelNumber"/></B></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan='4'>&nbsp;</td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <br>
            <table width='90%' bordercolor='black'  cellspacing='0'  cellpadding='0' align='center' style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black;border-bottom:2px solid black' <%=bgcolor%>>
                <tr><td class='NArialL'><B>2.0 Device Descriptor</B></td></tr>
                <tr>
                    <td align='center'>
                        <table width='50%' cellspacing='0'  cellpadding='0'>
                            <tr>
                                <td style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black'>
                                    <table width='100%'>
                                        <tr>
                                            <td width='50%' class='NArialL'><B>Device OPN</B></td>
                                            <td width='50%' class='NArialL'><B>&nbsp;<nested:write property="partNumber"/></B></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <br>
            <table width='90%' bordercolor='black'  cellspacing='0'  cellpadding='0' align='center' style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black;border-bottom:2px solid black' <%=bgcolor%>>
                <tr>
                    <td width='25%' class='NArialL'><B>3.0 Factory</B></td>
                    <td width='25%' class='NArialRS'>Factory</td>
                    <td width='50%' class='NArialRS'>&nbsp;<nested:write property="vendName"/></td>
                </tr>
                <tr>
                    <td class='NArialRS'>&nbsp;</td>
                    <td class='NArialRS'>Factory contact</td>
                    <td class='NArialRS'>&nbsp;<nested:write property="vendContactPerson"/></td>
                </tr>
                <tr>
                    <td class='NArialRS'>&nbsp;</td>
                    <td class='NArialRS'>email</td>
                    <td class='NArialRS'>&nbsp;<nested:write property="vendContactPersonEmail"/></td>
                </tr>
            </table>
            <br>
            <table width='90%' border='1' bordercolor='black' cellspacing='0'  cellpadding='0' align='center' <%=bgcolor%>>
                <tr>
                    <td colspan='2'>
                        <table width='100%'  cellspacing='0'  cellpadding='0' align='center'>
                            <tr>
                                <td width='92%' align='left' class='NArialL'><B>4.0 Wafer Information</B></td>
                            </tr>
                            <tr>
                                <td>
                                    <table width='44%' style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black' align='center' <%=bgcolor%>>
                                        <tr>
                                            <td align='center' width='50%' class='NArialRS'><B>Wafer Qty</B></td>
                                            <td align='center' width='50%' class='NArialRS'><B>&nbsp;<nested:write property="waferQty"/></B></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td width='92%' style='border:none'>
                        <table width='100%' border='1' bordercolor='black' cellspacing='0'  cellpadding='0' align='left' style='border-left:none;border-right:none;border-bottom:none;border-top:none' >
                            <tr>
                                <td align='center' width='28%' class='NArialRS'><B>Paper Work from TSMC<BR>says Fab Lot Number</B></td>
                                <td align='center' width='22%' class='NArialRS'><B>Wafer Scribe says</B></td>
                                <td align='center' width='22%' class='NArialRS'><B>Fab Lot # <BR>entered on EG for <BR>wafer probe</B></td>
                                <td align='center' width='28%' class='NArialRS'><B>Wafer # to be<BR>entered on EG<BR>for wafer probe</B></td>
                            </tr>
                            <nested:iterate property="sortReleaseLotList" type="com.scalar.chiptrac.operations.release.SortReleaseLot" >
                                <nested:iterate property="waferList" type="com.scalar.chiptrac.operations.release.SortReleaseWafer" indexId="iteratIdx">
                                    <tr>
                                        <td align='center' class='NArialRS'>&nbsp;<nested:write property="lotNumber"/></td>
                                        <nested:lessThan property="waferId" value="10">
                                            <td align='center' class='NArialRS'>&nbsp;<nested:write property="lotName"/>-0<nested:write property="waferId"/>xx</td>
                                        </nested:lessThan>
                                        <nested:greaterThan property="waferId" value="9">
                                            <td align='center' class='NArialRS'>&nbsp;<nested:write property="lotName"/>-<nested:write property="waferId"/>xx</td>
                                        </nested:greaterThan>
                                        <td align='center' class='NArialRS'>&nbsp;<nested:write property="lotName"/></td>
                                        <nested:lessThan property="waferId" value="10">
                                            <td align='center' class='NArialRS'>&nbsp;0<nested:write property="waferId"/></td>
                                        </nested:lessThan>
                                        <nested:greaterThan property="waferId" value="9">
                                            <td align='center' class='NArialRS'>&nbsp;<nested:write property="waferId"/></td>
                                        </nested:greaterThan>

                                    </tr>
                                </nested:iterate>
                            </nested:iterate>
                        </table>
                    </td>
                </tr>
            </table>
            <br>
            <table width='90%' bordercolor='black'  cellspacing='0'  cellpadding='0' align='center' style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black' <%=bgcolor%>>
                <tr>
                    <td class='NArialL'><B>5.0 Sort Program Information</B></td>
                </tr>

                <tr><td>&nbsp</td></tr>

                <tr>
                    <td style='border-top:1px solid black;border-bottom:1px solid black'>
                        <table width='100%'>

                        <!-- BR Jun 23 2005 -------  START -->
                            <tr>
                                <td style='border-right:1px solid black;border-bottom:1px solid black' bgcolor='#FFFFFF' width='20%' class='NArialRS' align='center'><B>Sort Spec</B></td>
                                <td style='border-right:1px solid black;border-bottom:1px solid black' bgcolor='#FFFFFF' width='20%' class='NArialRS' align='center'><b>Test Spec Rev</b></td>
								<td style='border-right:1px solid black;border-bottom:1px solid black' bgcolor='#FFFFFF' width='20%' class='NArialRS' align='center'><b>Test Program Name</b><td>
								<td style='border-right:1px solid black;border-bottom:1px solid black' bgcolor='#FFFFFF' width='20%' class='NArialRS' align='center'><b>Test Program Revision</b><td>
								<td style='border-right:1px solid black;border-bottom:1px solid black' bgcolor='#FFFFFF' width='20%' class='NArialRS' align='center'><b>Test Flow</b><td>
                            </tr>

							<nested:nest property="specificationFileSetupForm" >
                            <tr>
                                <td width='20%' class='NArialRS' align='center'><b>&nbsp;<nested:write property="specifincationFileName"/></b></td>
                                <td width='20%' class='NArialRS' align='center'><b>&nbsp;<nested:write property="revisionNumber"/></b></td>
								<td width='20%' class='NArialRS' align='center'><b>&nbsp;<nested:write property="testProgramName"/></b><td>
								<td width='20%' class='NArialRS' align='center'><b>&nbsp;<nested:write property="testProgramRevision"/></b><td>
								<td width='20%' class='NArialRS' align='center'><b>&nbsp;<nested:write property="testFlow"/></b><td>
                            </tr>
                            </nested:nest>

                        <!-- BR Jun 23 2005 -------  END -->

                        </table>
                    </td>
                </tr>



            </table>
            <br>
            <table width='90%' bordercolor='black'  cellspacing='0'  cellpadding='0' align='center' style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black;border-bottom:2px solid black' <%=bgcolor%>>
                <tr>
                    <td colspan='2' align='left' class='NArialL'><B>6.0 Shipping Requirements</B></td>
                </tr>
                <tr>
                    <td align='left' width='15%' class='NArialRS'>&nbsp;</td>
                    <td align='left' width='30%' class='NArialRS'>&nbsp;<nested:write property="shippingAddressAsString" filter="false"/></td>
                </tr>
                <tr>
                    <td colspan='2' align='left' class='NArialRS'><B>&nbsp;Freight Carrier: </B><nested:write property="shipperName"/></td>
                </tr>
            </table>
            <br>
            <table width='90%' bordercolor='black'  cellspacing='0'  cellpadding='0' align='center' style='border-left:2px solid black;border-top:2px solid black;border-right:2px solid black;border-bottom:2px solid black' <%=bgcolor%>>
                <tr>
                    <td align='left' class='NArialL'><B>7.0 Special Instructions.</B></td>
                </tr>
                <tr>
                    <td align='left' width='30%'>&nbsp;</td>
                </tr>
                <tr>
                     <td colspan='2' align='left' class='NArialRS'>&nbsp;<nested:write property="specialInstr"/></td>
                </tr>
            </table>
            </TD>
            </TR>
            </TABLE>
        </nested:nest>
    </html:form>
</BODY>
</HTML>